
<!DOCTYPE html>


<HTML><head>
    <meta charset="utf-8" />
    <meta content="IE=edge" http-equiv="X-UA-Compatible" />
    <meta content="width=device-width, initial-scale=1, user-scalable=no, target-densitydpi=device-dpi" name="viewport" />

    <title></title>

    <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>

</head>
<body>
<div id="window_tip"></div>
<div id="fh5co-wrapper">
    <div id="fh5co-page">
        <!--<div id="fh5co-header">
            <header id="fh5co-header-section">
                <div class="container">
                    <div class="nav-header">
                        <a href="#" class="js-fh5co-nav-toggle fh5co-nav-toggle"><i></i></a>
                        <h1 id="fh5co-logo"><a href="http://service.chinaforex.com.cn/training/platform/videocourse/index">中国外汇<span>在线</span></a></h1>
                        &lt;!&ndash; START #fh5co-menu-wrap &ndash;&gt;
                        <nav id="fh5co-menu-wrap" role="navigation">
                            <ul class="sf-menu" id="fh5co-primary-menu">
                                <li><a href="http://service.chinaforex.com.cn/training/platform/videocourse/index">概览</a></li>
                                <li><a href="http://service.chinaforex.com.cn/training/platform/videocourse/courseList">课程</a></li>
                                &lt;!&ndash;<li><a href="http://service.chinaforex.com.cn/training/platform/videocourse/app">APP客户端</a></li>&ndash;&gt;
                                <li><a href="http://service.chinaforex.com.cn/training/platform/videocourse/card">兑换卡</a></li>
                                <li><a href="http://service.chinaforex.com.cn/training/platform/videocourse/help">帮助</a></li>
                                <li><a href='http://service.chinaforex.com.cn/training/platform/videocourse/userlogin'>登录</a></li>
                                <li><a href='http://service.chinaforex.com.cn/training/platform/videocourse/userRegister'>快速注册</a></li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </header>
        </div>-->

        <div class="section fh5co-lightgray-section">
            <div class="minimal-wrapper">
                <div class="row text-center heading">
                    <h2>登陆</h2>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="login">
                        <form accept-charset="utf-8" id="useregister">
                        <div class="form-group">
                            <label>邮箱</label><input class="form-control" id="email" name="email" type="text" value="" />
                        </div>
						<div class="form-group">
                                <label>密码</label><input class="form-control" id="password" name="password" type="password" value="" />            <p class="small"><span class="glyphicon glyphicon-info-sign"></span> 至少6位</p>
                            </div>
                        </div>

                            <input name="return_url" type="hidden" value="" />
							
							<button onclick="registerAjax()" type="button">登陆</button>
                        </form> <br />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="section fh5co-lightgray-section">
            <div class="text-center">
                <p><small>没有账号? <a href="/static/register.html">立即注册</a></small></p>
            </div>
        </div>

        <script type="text/javascript">
            $.validator.setDefaults( {
                submitHandler: function (form) {
                    registerAjax();
                }
            } );

            $( document ).ready( function () {

                $( "#useregister" ).validate( {
                    rules: {
                        password: {
                            required: true,
                            minlength: 6
                        },
                        mobile: {
                            required: true,
                            minlength: 11,
                            digits:true
                        },
                        password2: {
                            required: true,
                            minlength: 6,
                            equalTo: "#password"
                        },
                        checkCode: {
                            required: true,
                        },
                    },
                    messages:{
                        checkCode: {
                            required: '请输入手机验证码',
                            checkCode:'验证码错误'
                        },
                        mobile: {
                            required: '请输入手机号',
                            minlength: '手机号长度不能小于11位',
                            digits: '请输入合法的手机号',
                        },
                        password:{
                            required: '请输入密码',
                            minlength: '密码长度不能小于6位'
                        },
                        password2: {
                            required: "请输入确认密码",
                            minlength: '密码长度不能小于6位',
                            equalTo: "两次输入密码不一致"
                        }
                    },
                    ignore: ".ignore",
                    errorPlacement: function ( error, element ) {
                        error.addClass( "help-block" );
                        element.parents( ".form-group" ).addClass( "has-feedback" );
                        if ( element.prop( "type" ) === "checkbox" ) {
                            error.insertAfter( element.parent( "label" ) );
                        } else {
                            error.insertAfter( element );
                        }
                        if ( !element.next( "span" )[ 0 ] ) {
                            $( "<span class='glyphicon glyphicon-remove form-control-feedback'></span>" ).insertAfter( element );
                        }
                    },
                    success: function ( label, element ) {
                        if ( !$( element ).next( "span" )[ 0 ] ) {
                            $( "<span class='glyphicon glyphicon-ok form-control-feedback'></span>" ).insertAfter( $( element ) );
                        }
                    },
                    highlight: function ( element, errorClass, validClass ) {
                        $( element ).parents( ".form-group" ).addClass( "has-error" ).removeClass( "has-success" );
                        $( element ).next( "span[class*='glyphicon']" ).addClass( "glyphicon-remove" ).removeClass( "glyphicon-ok" );
                    },
                    unhighlight: function ( element, errorClass, validClass ) {
                        $( element ).parents( ".form-group" ).addClass( "has-success" ).removeClass( "has-error" );
                        $( element ).next( "span[class*='glyphicon']" ).addClass( "glyphicon-ok" ).removeClass( "glyphicon-remove" );
                    }
                } );
            } );
        </script>
        <footer>
            <div id="footer">
            </div>
        </footer>
    </div>
    <!-- END fh5co-page -->
</div>
<!-- END fh5co-wrapper -->
<script type="text/javascript">

    if (!$.support.leadingWhitespace) {
        $("#window_tip").append("<div class=\"alert alert-warning text-center\" role=\"alert\">您使用的浏览器版本过低，如果页面显示不正常，建议您升级或更换浏览器，推荐您使用Chrome或Firefox浏览器</div>");
    }

    function is_weixn(){
        var ua = navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i)=="micromessenger") {
            return true;
        } else {
            return false;
        }
    }

    function registerAjax() {
	var email = $("#email").val();
	var password = $("#password").val();
        $.ajax({
            type: "GET",
            url:"/api/user/login/"+email+"/"+password,
            success: function (data) {
                if(data.success=="true"){
                    window.location.href = "/static/welcome.html";
                }else{
                    alert(data.message);
                }
            },
            error: function () {
                alert("系统异常，请重试");
            }
        });
    }

    $(document).ready(function(){

    });

    if(is_weixn()){
        $('#weichat_tip').show();
    }else{
        $('#weichat_tip').hide();
    }
</script>


</body></HTML>